package com.yunfeng.supercall.bean;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.os.Parcel;
import android.text.TextUtils;

import com.yunfeng.supercall.R;

public class SystemContactsBean2 extends ContactsBaseBean2 {

	public static final int[] ICONS_SUPER = new int[] {
			R.drawable.ic_new_super_friend, R.drawable.ic_super_friend_group,
			R.drawable.ic_my_circle, R.drawable.ic_bussiness_super_friend,
			R.drawable.ic_wechat_circle, R.drawable.ic_wechat_friends,
			R.drawable.ic_qq_friends, R.drawable.ic_sms,
			R.drawable.ic_weibo_friends };

	public static final int[] ICONS_ADD = new int[] {
			R.drawable.ic_super_man_near_by, R.drawable.ic_busseness_near_by,
			R.drawable.ic_circle_near_by };
	public static final int[] ICONS_GROUP = new int[] {
			R.drawable.ic_super_school, R.drawable.ic_create_group,
			R.drawable.ic_family, R.drawable.ic_brother, R.drawable.ic_sister,
			R.drawable.ic_client, R.drawable.ic_fans, R.drawable.ic_follows };
	public static final int[] ICONS_SHARE = new int[] {
			R.drawable.ic_i_want_to_share, R.drawable.ic_super_friend_share,
			R.drawable.ic_fans, R.drawable.ic_focuser };

	public static final List<SystemContactsBean2> getSystemSuperContactsList(
			Context context) {
		List<SystemContactsBean2> contacts = new ArrayList<SystemContactsBean2>();
		String[] names = context.getResources().getStringArray(
				R.array.systemFriendsNames);
		for (int i = 0, j = names.length; i < j; i++) {
			SystemContactsBean2 systemContacts = new SystemContactsBean2();
			systemContacts.setNick_name(names[i]);
			systemContacts.setImgId(ICONS_SUPER[i]);
			if (i == 0) {
				systemContacts.setSticky("分组");
			} else if (i > 0 && i <= 3) {
				systemContacts.setSticky("分组");
			} else if (i > 3 && i <= 8) {
				systemContacts.setSticky("社交圈");
			}
			contacts.add(systemContacts);
		}
		return contacts;
	}

	public static final List<SystemContactsBean2> getSheJiaoPingtai(Context context) {
		List<SystemContactsBean2> contacts = new ArrayList<SystemContactsBean2>();
		String[] names = context.getResources().getStringArray(
				R.array.systemFriendsNames);
		for (int i = 4, j = names.length; i < j; i++) {
			SystemContactsBean2 systemContacts = new SystemContactsBean2();
			systemContacts.setNick_name(names[i]);
			systemContacts.setImgId(ICONS_SUPER[i]);
			systemContacts.setSticky("#");

			contacts.add(systemContacts);
		}
		return contacts;
	}

	public static final List<SystemContactsBean2> getShareSystemContactsList(
			Context context) {
		List<SystemContactsBean2> contacts = new ArrayList<SystemContactsBean2>();
		String[] names = context.getResources().getStringArray(
				R.array.systemShareFriendsNames);
		for (int i = 0, j = names.length; i < j; i++) {
			SystemContactsBean2 systemContacts = new SystemContactsBean2();
			systemContacts.setNick_name(names[i]);
			systemContacts.setImgId(ICONS_SHARE[i]);
			if (i == 0) {
				systemContacts.setSticky("~");
			} else {
				systemContacts.setSticky("-");
			}

			contacts.add(systemContacts);
		}
		return contacts;
	}

	public static final List<SystemContactsBean2> getAddSystemContactsList(
			Context context) {
		List<SystemContactsBean2> contacts = new ArrayList<SystemContactsBean2>();
		String[] names = context.getResources().getStringArray(
				R.array.systemAddFriendsNames);
		for (int i = 0, j = names.length; i < j; i++) {
			SystemContactsBean2 systemContacts = new SystemContactsBean2();
			systemContacts.setNick_name(names[i]);
			systemContacts.setImgId(ICONS_ADD[i]);
			systemContacts.setSticky("-");
			contacts.add(systemContacts);
		}
		return contacts;

	}

	public static final List<? extends SystemContactsBean2> getGroupSystemContactsList(
			Context context) {
		List<SystemContactsBean2> contacts = new ArrayList<SystemContactsBean2>();
		String[] names = context.getResources().getStringArray(
				R.array.systemFriendsGroupNames);
		for (int i = 0, j = names.length; i < j; i++) {
			SystemContactsBean2 systemContacts = new SystemContactsBean2();
			systemContacts.setNick_name(names[i]);
			systemContacts.setImgId(ICONS_GROUP[i]);
			systemContacts.setSticky("-");
			contacts.add(systemContacts);
		}
		return contacts;

	}

	@Override
	public String getStickyItem() {
		// TODO Auto-generated method stub
		return sticky;
	}

	private int imgId;
	private String sticky;

	public String getSticky() {
		if (TextUtils.isEmpty(sticky)) {
			return "-";
		}
		return sticky;
	}

	public void setSticky(String sticky) {
		this.sticky = sticky;
	}

	public int getImgId() {
		return imgId;
	}

	public void setImgId(int imgId) {
		this.imgId = imgId;
	}

	public static final Creator<SystemContactsBean2> CREATOR = new Creator<SystemContactsBean2>() {

		@Override
		public SystemContactsBean2[] newArray(int size) {
			// TODO Auto-generated method stub
			return new SystemContactsBean2[size];
		}

		@Override
		public SystemContactsBean2 createFromParcel(Parcel source) {
			// TODO Auto-generated method stub
			return new SystemContactsBean2(source);
		}
	};

	public SystemContactsBean2() {
	}

	public SystemContactsBean2(Parcel parcel) {
		super(parcel);
		imgId = parcel.readInt();
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		super.writeToParcel(dest, flags);
		dest.writeInt(imgId);
	}

	@Override
	public int getContactsType() {
		// TODO Auto-generated method stub
		return TYPE_SYSTEM_CONTACTS;
	}

}
